package com.penghk.learn.learnhadoopinspringboot.cofig;

import org.apache.hadoop.fs.FileSystem;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

@Configuration
public class HadoopConfig {

    @Bean
    public org.apache.hadoop.conf.Configuration configuration() {
        org.apache.hadoop.conf.Configuration configuration = new org.apache.hadoop.conf.Configuration();
//        configuration.set("fs.default.name" , "hdfs://localhost:9000");

        configuration.set("fs.defaultFS" , "hdfs://localhost:9000");

//        configuration.set("fs.hdfs.impl",DistributedFileSystem.class.getName());
        return configuration;

    }

    @Bean
    public FileSystem fileSystem() throws IOException {
        return FileSystem.get(configuration());
    }

//    @Bean
//    public HbaseTemplate hbaseTemplate(@Value("${hbase.zookeeper.quorum}") String quorum,
//                                       @Value("${hbase.zookeeper.port}") String port) {
//        HbaseTemplate hbaseTemplate = new HbaseTemplate();
//        org.apache.hadoop.conf.Configuration conf = HBaseConfiguration.create();
//        conf.set("hbase.zookeeper.quorum", quorum);
//        conf.set("hbase.zookeeper.port", port);
//        hbaseTemplate.setConfiguration(conf);
//        hbaseTemplate.setAutoFlush(true);
//        return hbaseTemplate;
//    }

}
